<?php
namespace app\api\controller;

use function Workbunny\WebmanRabbitMQ\sync_publish;
use plugin\saiadmin\basic\BaseController;
use process\workbunny\rabbitmq\Test1BuilderDelayed;
use support\Request;

class TestController extends BaseController
{

    public function index(Request $request)
    {
        $name = $request->get('name');
        sync_publish(Test1BuilderDelayed::instance(), $name, headers: [
            'x-delay' => 10 * 1000, # 延迟10秒
        ]);
        return $this->success();
    }
}
